//
//  CAAddBankViewController.m
//  LNH
//
//  Created by twentylx on 2018/2/8.
//  Copyright © 2018年 twentylx. All rights reserved.
//

#import "CAAddBankViewController.h"
#import "CAAddBankView.h"
#import "CAAddBankStep2ViewController.h"

@interface CAAddBankViewController ()

@property (nonatomic, strong) CAAddBankView *addBankView;

@end

@implementation CAAddBankViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/// 初始化数据
- (void)lm_initialDefaultsForController {
    
}

/// 绑定 vm
- (void)lm_bindViewModelForController {
    
}

/// 创建视图
- (void)lm_createViewForController {
    [self.view setNeedsUpdateConstraints];
    
    [self.view addSubview:self.addBankView];
}

/// 配置导航栏
- (void)lm_configNavigationForController {
    self.navigationItem.title = @"添加银行卡";
}

#pragma makr layout
- (void)updateViewConstraints {
    [super updateViewConstraints];
    
    [_addBankView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.and.right.equalTo(self.view);
        make.top.equalTo(self.view);
        make.height.mas_equalTo(400);
    }];
}

#pragma mark get & set
- (CAAddBankView *)addBankView {
    if (!_addBankView) {
        _addBankView = [CAAddBankView new];
        [_addBankView.nextButton addTarget:self action:@selector(nextAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _addBankView;
}

#pragma mark private method
- (void) nextAction {
    CAAddBankStep2ViewController *addBank2VC = [CAAddBankStep2ViewController new];
    addBank2VC.name = self.addBankView.nameTextField.text;
    addBank2VC.cardNo = self.addBankView.cardNoTextField.text;
    [self.navigationController pushViewController:addBank2VC animated:YES];
}

@end
